using System;
using System.Numerics;

namespace ProjectEuler.Core
{
    public class Problem16 : IProjectEulerProblem
    {
        protected int SumOfDigits(string digits)
        {
            int Sum = 0;
            for (int x = 0; x < digits.Length; x++)
            {
                Sum += Int32.Parse(digits.Substring(x, 1));
            }
            return Sum;
        }

        public int Number
        {
            get { return 16; }
        }

        public string Description
        {
            get { return "What is the sum of the digits of the number 2^1000?"; }
        }

        public string Answer
        {
            get
            {
                var bigNumber = new BigInteger(1);
                bigNumber <<= 1000;
                return SumOfDigits(bigNumber.ToString()).ToString();
            }
        }
    }
}